
#pragma once

#include "technique.h"

namespace EggNine {

enum MeshPresentMethod {
    PRESENT_SIMPLE,
    PRESENT_TESSELATED,
};

enum MeshSimulateMethod {
    SIMULATE_RIGID_DYN,
    SIMULATE_RIGID_STAT,
    SIMULATE_2D,
    SIMULATE_NONE
};

class IMesh {
public:
    virtual ~IMesh() {}

    void* operator new(size_t size);
    void operator delete(void* addr);
};

class PresentableMesh : virtual public IMesh {
    MeshPresentMethod m_presentMethod;

public:

    PresentableMesh(MeshPresentMethod presentMethod)
        : m_presentMethod(presentMethod) {}

    virtual void Draw(const IProgram* pTechnique)=0;

    virtual void AttachUniforms(const UniformMap& uBlocks)=0;
    virtual void MapAttributes(const ProgramsMap& tMap)=0;

    MeshPresentMethod PresentMethod() const {return m_presentMethod;}
};

class SimulateableMesh : virtual public IMesh {
    MeshSimulateMethod m_simulateMethod;

public:
    SimulateableMesh(MeshSimulateMethod simulateMethod)
        : m_simulateMethod(simulateMethod) {}

    virtual void Simulate(float dt, const IProgram* pTechnique)=0;
    MeshSimulateMethod SimulateMethod() const {return m_simulateMethod;}
};

} // EggNine
